import numpy as np

PATCH_COUNT = 10000

patchesMM = np.memmap('patchessmall', dtype='float32', mode='r', shape = (PATCH_COUNT, 32, 32, 1))
patches = np.zeros((PATCH_COUNT, 32, 32))
patches[:] = patchesMM[:, :, :, 0]

removeSize = 0
rmBounds = np.zeros((patches.shape))

for i in range(patches.shape[0]):
        randRow = np.random.randint(patches.shape[1] - removeSize - 1)
        randCol = np.random.randint(patches.shape[2] - removeSize - 1)
        rowEnd = randRow + removeSize
        colEnd = randCol + removeSize

        rmBounds[i, randRow:rowEnd, randCol:colEnd] = 1.0

        min = np.min(patches[i])

        patches[i, randRow:rowEnd, randCol:colEnd] = min

rmBounds = np.where(rmBounds == 1.0)

np.save('patches_1000_mod.npy', patches)
np.save('patches_1000_rmbounds.npy', np.array(rmBounds))
